<template>
  <div class="parameter">
    <h4>商品参数</h4>
    <div v-for="(item,index) in attribute" :key="index">
      <div>{{item.attribute}}</div>
      <div>{{item.value | ellipsis}}</div>
    </div>
  </div>
</template>

<script>
export default {
  name: "Parameter",
  props: ["attribute"],
  data() {
    return {};
  },
  filters: {
    ellipsis(value) {
      if (!value) return "";
      if (value.length > 10) {
        return value.slice(0, 10) + "...";
      }
      return value;
    }
  }
};
</script>

<style lang="less" scoped>
.parameter {
  width: 95%;
  height: 200px;
  background-color: #fff;
  border-radius: 16px;
  margin: 0 auto;
  margin-bottom: 20px;
  font-size: 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  div{
      width: 90%;
      display: flex;
      justify-content: flex-start;
      align-items: flex-start;
      :nth-child(2){
        color: #888;
      }
  }
}
</style>